Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

302
Vistas
Make VoiceOver say "Swipe Up or Down to Select a Custom Action, then double tap to activate"

I have a UITextView with two different hyperlinks in it. To give the chance to choose between the two links when VoiceOver is on, I did:

class MyTextView {
   override func awakeFromNib() {
       super.awakeFromNib()
       let str = "xxxxxx Option 1 yyyy Option 2"
       let attrStr = NSMutableAttributedString(str)
       let rangeOption1 = (str as NSString).range(of: "Option 1")
       let rangeOption2 = (str as NSString).range(of: "Option 2")
       attrStr.addAttributes([.link: "option1", range: rangeOption1])
       attrStr.addAttributes([.link: "option2", range: rangeOption2])

       self.attributedText = attrStr
   }

   override var isAccessibilityElement: Bool {
       get { return true }
       set {}
   }

   override var accessibilityLabel: String? {
       get { return "Link Options" }
       set {}
   }

   override var accessibilityCustomActions: [UIAccessibilityCustomAction]? {
       get {
           return [
                UIAccessibilityCustomAction(name: "Choose Option One", target: self, selector: #selector(option1)),
                UIAccessibilityCustomAction(name: "Choose Option Two", target: self, selector: #selector(option2))]
       }
       set {}
   }

   @objc func option1() { print ("Option 1") }
   @objc func option2() { print ("Option 2") }
}

I did this following this WWDC video from min 33. What I can not manage is that it says Swipe Up or Down to Select a Custom Action, then double tap to activate when the textView is focused.

Right now it says "xxxxxx Option 1 [pause] link [pause] yyyy Option 2 [pause] link [pause]"

Once the textView is focused, if I swipe down on it it tells me the "Choose Option One" and "Choose Option Two". If after it says "Choose Option X" I double tap, the correction option is chosen.

Technically all is good, I just want to to announce the instructions to the user as it does in the video. Worst case scenario I will just append that to the accessibilityLabel, but that's hacky.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

  • When accessibilityCustomActions is set, OS announce "Actions Available. Swipe Up or Down to Select a Custom Action, then double tap to activate"
  • You can set the accessibilityHint to provide a custom message.
over 4 years ago · Santiago Trujillo Denunciar

0

I may be wrong but actions can't be read out as you mentioned, just adjustable values can.

I followed the content of this video thanks to this detailed summary and I heard :

  • "Adjustable, swipe up or down with one finger to adjust the value" for the adjustable element : video.
  • "Actions available" only when the element with custom actions is selected : video.

"Actions available" is only read out with actions as you implemented, you cannot have anything else natively.

If I'm wrong, please let me know the timelapse of the WWDC video you heard what you mentioned, please ?

Now, if you need further information with the .adjustable trait, including illustrations and code snippets (ObjC + Swift), I suggest you take a look at this site.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda